import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Question } from './question.entity';

@Injectable()
export class QuestionService {
  constructor(
    @InjectRepository(Question)
    private readonly questionRepository: Repository<Question>,
  ) {}

  async create(body): Promise<Partial<Question[]>> {
    const res = this.questionRepository.create({ ...body });
    return await this.questionRepository.save(res);
  }
  async getAll(): Promise<Partial<Question[]>> {
    const res = await this.questionRepository.find();
    return res;
  }
}
